package com.mushuilingfeng.ddd.user.domain;

import com.mushuilingfeng.ddd.user.domain.user.dto.AbstractLoginDto;
import com.mushuilingfeng.ddd.user.domain.user.enums.LoginTypeEnum;
import com.mushuilingfeng.ddd.user.domain.user.vo.UserLoginLog;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author 沐水淋风
 * @date 2024/10/4
 */
@Mapper(builder = @Builder)
public interface IDataCover {
    
    IDataCover INSTANCE = Mappers.getMapper(IDataCover.class);
    
    @Mapping(target = "userId", source = "userId")
    @Mapping(expression = "java(new java.util.Date())", target = "loginTime")
    @Mapping(target = "loginType", source = "loginType")
    UserLoginLog toUserLoginLog(AbstractLoginDto dto, Long userId, LoginTypeEnum loginType);
    
}
